package com.heima.admin.controller.v1;

import com.alibaba.fastjson.JSON;
import com.heima.admin.service.AdUserService;
import com.heima.apis.user.IUserClient;
import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDto;
import com.heima.model.user.pojos.ApUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
public class AdAuthUserController {

    @Autowired
    private IUserClient userClient;
//    @Autowired
//    private IWemediaClient wemediaClient;
    @Autowired
    private AdUserService adUserService;

    @PostMapping("/list")
    public ResponseResult findList(@RequestBody AuthDto dto){
        ResponseResult result = userClient.findAuthList(dto);
        return result;
    }

    @PostMapping("/authFail")
    public ResponseResult updateAuthFail(@RequestBody AuthDto dto){
        userClient.authFail(dto);
        return ResponseResult.okResult(null);
    }

    @PostMapping("/authPass")
    public ResponseResult updateAuthPass(@RequestBody AuthDto dto){
        userClient.authPass(dto);

//        //创建自媒体账号
//        wemediaClient.createWmUser(apUser);
        return ResponseResult.okResult(null);
    }
}
